<template>
  <div style="text-align: left">
    <div style="width: 100%;text-align: center">
      <h2>{{title}}</h2>
      <hr/>
      <span style="font-size: 14px;color: #c1c1c1;">时间：{{getTime(time)}}&nbsp;</span>
    </div>

    <el-col id="asd" v-html="content" style="margin-top: 40px;overflow-x:hidden;"></el-col>
    <span>附件：</span>
    <el-table
      :data="files"
      stripe
      border
      style="width: 400px;margin-top: 10px">
      <el-table-column
        label="文件名"
        align="center"
        prop="name">
      </el-table-column>
      <el-table-column
        label="操作"
        align="center"
        width="60">
        <template slot-scope="scope">
          <a :href="scope.row.url">下载</a>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
    import {noticeMsg} from '../../axios/api'
    export default {
        name: "msg",
        data(){
            return{
                content:'',
                title:"",
                time:"",
                files:[]
            }
        },
        mounted() {
            this.getMSG();
        },
        methods:{
          getMSG:async function(){
              if (this.$route.query.id === undefined || this.$route.query.id === ""){
                  this.alert("warning","缺失文章id");
                  this.$router.push({ path:'/user'})
                  return
              }
              let data = {id:this.$route.query.id};
              let res = await noticeMsg(data);
              if (res.code === 0){
                  this.title = res.salaryNotice.title;
                  this.time = res.salaryNotice.createTime;
                  this.content = res.salaryNotice.content;
                  this.files = JSON.parse(res.salaryNotice.files);
              }
          }
        }
    }
</script>

<style scoped>

</style>
